<template>
  <EwgDialog ref="Dialog" @close="close()" modal>
    <div class="attr-dialog">
      <div class="header">
        <span>人物属性</span>
        <span class="pointer" @click="close()">关闭</span>
      </div>
      <div class="content">
        <div title="加成攻击力">力量: {{ currentAttrs.STR }}</div>
        <div title="决定生命值和回复能力，加成防御力">
          体质: {{ currentAttrs.VIT }}
        </div>
        <div title="加成攻击速度和暴击率">敏捷: {{ currentAttrs.DEX }}</div>
        <div></div>
        <div>生命值: {{ currentAttrs.HP }}</div>
        <div>生命缓和: {{ currentAttrs.RHP }}</div>
        <div>攻击力: {{ currentAttrs.ATK }}</div>
        <div>防御力: {{ currentAttrs.DEF }}</div>
        <div>攻击速度: {{ currentAttrs.AS }}</div>
        <div>暴击率: {{ (currentAttrs.CRR * 100).toFixed(2) }}%</div>
        <div>暴击伤害: {{ (currentAttrs.CRD * 100).toFixed(2) }}%</div>
      </div>
      <div class="footer"></div>
    </div>
  </EwgDialog>
</template>
<script lang="ts">
import { computed, ref, ComputedRef } from "vue";
import { useStore } from "@/store";
import { PlayerBattleProperty } from "@/store/player/types";
const store = useStore();
export default {
  name: "AttrsDialog",
  setup() {
    const Dialog = ref();
    const currentAttrs: ComputedRef<PlayerBattleProperty> = computed(() => {
      return store.getters.playerBattleProperty;
    });
    const close = () => {
      Dialog.value.close();
    };
    const open = () => {
      Dialog.value.open();
    };
    return {
      Dialog,
      currentAttrs,
      close,
      open
    };
  }
};
</script>
<style lang="scss" scoped>
.attr-dialog {
  width: 500px;
  background: $--color-black-half-quarter;
  color: #eee;
  border: 3px solid $--color-white;
  padding: 20px;
  border-radius: $--border-radius;
  .header {
    display: flex;
    justify-content: space-between;
  }
  .content {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
</style>
